package com.yuqih.common.json;

import java.io.IOException;
import java.util.Date;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.yuqih.common.spring.DateConverter;

public class DateJsonDeserializer extends JsonDeserializer<Date> {
	
	@Override
	public Date deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
		String date = p.readValueAs(String.class);
		
		return DateConverter.instance.convert(date);
	}

}
